Fix: Handle binary file uploads on Plain Text pages correctly#2125
Fix: Handle binary file uploads on Plain Text pages correctly#2125UlrichB22 merged 2 commits intomoinwiki:masterfrom
Conversation
|
@srikaaviya, did you install the pre-commit hooks in your development environment as described in |
|
I'm not quite sure if it is a good idea to be able to switch from "text" content to binary content. One immediate problem this will trigger is how diffs between item revisions behave. Does Moin2 even support switching markup type from e.g. markdown to rST? |
Yes, there is a |
Yes, I installed and ran the pre-commit hooks. |
Yes, switching content types will cause the Diff view to crash. However, I can implement a safety check to fix this: if the content types are different, the Diff view will simply show a message saying they cannot be compared, instead of error. Will it work? |
|
Yes, please add the check to avoid tracebacks. |
31e29a4 to
175e5c3
Compare
Done! I've added the checks to prevent the traceback and squashed the commits. |
|
Thanks for the updates.
|
cb9b1c6 to
333115a
Compare
|
Thanks for review. I reverted the pyproject.toml changes. Also displayed the error message as warning |
|
Latest findings:
|
|
Apologies! I have now synchronized pyproject.toml to match master exactly. |
Previously, uploading a binary file (e.g., .pages, .pdf) to replace a Text page caused a 'UnicodeDecodeError or data validation error' because the system attempted to decode the binary content as text based on the existing page type.
This commit: